package xyx.ysfwpt.controller;

import io.swagger.annotations.*;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import xyx.ysfwpt.model.InputList1;
import xyx.ysfwpt.model.InputList2;
import xyx.ysfwpt.service.InputListService;


import java.util.List;

@Controller
@RequestMapping("/ysfwpt")
@Api(tags = {"输入框接口"},description = "")
public class InputListController {

    @Autowired
    InputListService inputListService;

    @ApiOperation(value = "查询临床职称",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectClinicalTitle")
    @ResponseBody
    public JSONObject selectClinicalTitle(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> clinical_title = inputListService.selectClinicalTitle();
        jsonObject.put("clinical_title",clinical_title);
        return jsonObject;
    }

    @ApiOperation(value = "查询教学职称",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectTeachingTitle")
    @ResponseBody
    public JSONObject selectTeachingTitle(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> teaching_title = inputListService.selectTeachingTitle();
        jsonObject.put("teaching_title",teaching_title);
        return jsonObject;
    }

    @ApiOperation(value = "查询科室",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectDepartment")
    @ResponseBody
    public JSONObject selectDepartment(){
        JSONObject jsonObject = new JSONObject();
        List<InputList2> department = inputListService.selectDepartment();
        jsonObject.put("department",department);
        return jsonObject;
    }

    @ApiOperation(value = "查询用户类型",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectUserType")
    @ResponseBody
    public JSONObject selectUserType(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> type = inputListService.selectUserType();
        jsonObject.put("type",type);
        return jsonObject;
    }

    @ApiOperation(value = "查询用户来源",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectUserSource")
    @ResponseBody
    public JSONObject selectUserSource(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> source = inputListService.selectUserSource();
        jsonObject.put("source",source);
        return jsonObject;
    }

    @ApiOperation(value = "查询用户状态",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectUserState")
    @ResponseBody
    public JSONObject selectUserState(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> state = inputListService.selectUserState();
        jsonObject.put("state",state);
        return jsonObject;
    }

    @ApiOperation(value = "查询用户状态",notes = "根据id查询状态（已冻结，已认证，未认证，认证失败）")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @RequestMapping(value="/selectUserStateById",method=RequestMethod.POST)
    @ResponseBody
    public JSONObject selectUserStateById(@ApiParam(value = "ID",required = true) @RequestParam(value = "id", required = true)int id){
        JSONObject jsonObject = new JSONObject();
        InputList1 inputList = inputListService.selectUserStateById(id);
        jsonObject.put("inputList",inputList);
        return jsonObject;
    }

    @ApiOperation(value = "查询科室主任",notes = "根据name查询科室主任")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @RequestMapping(value="/selectDirectorByName",method=RequestMethod.POST)
    @ResponseBody
    public JSONObject selectDirectorByName(@ApiParam(value = "名称",required = true) @RequestParam(value = "name", required = true)String name){
        JSONObject jsonObject = new JSONObject();
        InputList2 department = inputListService.selectDirectorByName(name);
        jsonObject.put("department",department);
        return jsonObject;
    }

    @ApiOperation(value = "查询订单来源",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectOrderSource")
    @ResponseBody
    public JSONObject selectOrderSource(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> source = inputListService.selectOrderSource();
        jsonObject.put("source",source);
        return jsonObject;
    }

    @ApiOperation(value = "查询自取订单状态",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectOfflineOrderState")
    @ResponseBody
    public JSONObject selectOfflineOrderState(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> state = inputListService.selectOfflineOrderState();
        jsonObject.put("state",state);
        return jsonObject;
    }

    @ApiOperation(value = "根据id查询自取订单状态",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @RequestMapping(value = "/selectOfflineOrderStateById",method=RequestMethod.POST)
    @ResponseBody
    public JSONObject selectOfflineOrderStateById(@ApiParam(value = "ID",required = true) @RequestParam(value = "id", required = true)int id){
        JSONObject jsonObject = new JSONObject();
        InputList1 state = inputListService.selectOfflineOrderStateById(id);
        jsonObject.put("state",state);
        return jsonObject;
    }

    @ApiOperation(value = "查询在线订单状态",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectOnlineOrderState")
    @ResponseBody
    public JSONObject selectOnlineOrderState(){
        JSONObject jsonObject = new JSONObject();
        List<InputList1> state = inputListService.selectOnlineOrderState();
        jsonObject.put("state",state);
        return jsonObject;
    }

    @ApiOperation(value = "根据id查询在线订单状态",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @RequestMapping(value = "/selectOnlineOrderStateById",method=RequestMethod.POST)
    @ResponseBody
    public JSONObject selectOnlineOrderStateById(@ApiParam(value = "ID",required = true) @RequestParam(value = "id", required = true)int id){
        JSONObject jsonObject = new JSONObject();
        InputList1 state = inputListService.selectOnlineOrderStateById(id);
        jsonObject.put("state",state);
        return jsonObject;
    }

    @ApiOperation(value = "查询快递公司",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectPleasant")
    @ResponseBody
    public JSONObject selectPleasant(){
        JSONObject jsonObject = new JSONObject();
        List list = inputListService.selectPleasant();
        jsonObject.put("list",list);
        return jsonObject;
    }

    @ApiOperation(value = "查询生产厂商",notes = "查询所有输入信息")
    @ApiResponses(value = { @ApiResponse(code = 200, message = "查询成功")})
    @GetMapping(value = "/selectManufacturer")
    @ResponseBody
    public JSONObject selectManufacturer(){
        JSONObject jsonObject = new JSONObject();
        List list = inputListService.selectManufacturer();
        jsonObject.put("list",list);
        return jsonObject;
    }

}